package org.ch02.sk.demo08;

import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.MethodDescriptor;
import java.lang.reflect.Method;

/**
 * @author XCH
 * @date 2025 - 03 - 24
 */
public class MainTest {
    public static void main(String[] args) {
        try {
            BeanInfo beanInfo = Introspector.getBeanInfo(Person.class);
            MethodDescriptor[] methodDescriptors = beanInfo.getMethodDescriptors();
            for (MethodDescriptor methodDescriptor : methodDescriptors) {
                Method method = methodDescriptor.getMethod();
                System.out.println("Method: " + method.getName());
                System.out.println("  Return Type: " + method.getReturnType());
                System.out.println("  Parameters: " + method.getParameterCount());
                System.out.println();
            }
        } catch (IntrospectionException e) {
            throw new RuntimeException(e);
        }
    }
}
